/**
 * Tencent is pleased to support the open source community by making Tars available.
 *
 * Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
 *
 * Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * https://opensource.org/licenses/BSD-3-Clause
 *
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
// **********************************************************************
// This file was generated by a TARS parser!
// TARS version 1.0.1.
// **********************************************************************

package com.qq.tars.support.property.prx;

import com.qq.tars.protocol.util.*;
import com.qq.tars.protocol.annotation.*;
import com.qq.tars.protocol.tars.*;
import com.qq.tars.protocol.tars.annotation.*;

@TarsStruct
public class StatPropInfo {

	@TarsStructProperty(order = 0, isRequire = true)
	public String policy = "";
	@TarsStructProperty(order = 1, isRequire = true)
	public String value = "";

	public String getPolicy() {
		return policy;
	}

	public void setPolicy(String policy) {
		this.policy = policy;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public StatPropInfo() {
	}

	public StatPropInfo(String policy, String value) {
		this.policy = policy;
		this.value = value;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + TarsUtil.hashCode(policy);
		result = prime * result + TarsUtil.hashCode(value);
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof StatPropInfo)) {
			return false;
		}
		StatPropInfo other = (StatPropInfo) obj;
		return (
			TarsUtil.equals(policy, other.policy) &&
			TarsUtil.equals(value, other.value) 
		);
	}

	public void writeTo(TarsOutputStream _os) {
		if (null != policy) {
			_os.write(policy, 0);
		}
		if (null != value) {
			_os.write(value, 1);
		}
	}

	public void readFrom(TarsInputStream _is) {
		this.policy = _is.read(policy, 0, true);
		this.value = _is.read(value, 1, true);
	}

}
